package de.general;

import java.io.DataOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Date;

public class Eeg02File {

	public static void main(String[] args)  {
		
		// Como crear un archivo-File en binario
		File file = new File("test.dat");
		FileOutputStream fout = null;
		DataOutputStream out = null;
		FileOutputStream fout2 = null;
		ObjectOutputStream out2 = null;
		
		try{
			fout = new FileOutputStream(file);
			out = new DataOutputStream(fout);
			out.writeBoolean(false);
			out.writeInt(45);
			fout2 = new FileOutputStream(file);
		    out2 = new ObjectOutputStream(fout2);
		    out2.writeObject(new Date());
			
		}catch(IOException e ){
			System.out.println(e);
		}finally{
			try{
			fout.close();
			out.close();
			}catch(Exception e){
				System.out.println(e);
			}
		}
		
		

	}

}
